package com.itheima.mapper;

import com.itheima.pojo.Game;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.PathVariable;

import java.awt.print.Book;
import java.util.List;

/**
 * @author ChaunceyZhang
 * @date 2022-10-21 21:18
 * @blog1 https://zephyr-cyber.github.io/
 * @blog2 https://www.yuque.com/gougougou-xwscx
 */
public interface GameMapper {

    @Insert("insert into tb_game (id,name,type,url,ordered,company) " +
            "values (#{id},#{name}, #{type}, #{url}, #{ordered},#{company})")
    Boolean save(Game game);

    @Update("update tb_game set " +
            "type = #{type}, name = #{name}, url = #{url}, ordered = #{ordered}, company =#{company} " +
            "where id = #{id}")
    Boolean update(Game game);

    @Delete("delete from tb_game where id = #{id}")
    Boolean delete(Integer id);

    @Select("select * from tb_game")
    List<Game> findAll();

}
